// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   getRateFromID.java

package include.get_rate_from_ID;

import include.nseer_db.nseer_db;
import java.sql.ResultSet;

public class getRateFromID
{

	private String file_ID;
	private String table_name;
	private String field_name;
	private String sql;
	private String field_name1;
	private double getRateFromID;

	public getRateFromID()
	{
		file_ID = "";
		table_name = "";
		field_name = "";
		sql = "";
		field_name1 = "";
		getRateFromID = 0.0D;
	}

	public double getRateFromID(String unit_db_name, String table_name, String field_name, String file_ID, String field_name1)
	{
		this.file_ID = file_ID;
		this.table_name = table_name;
		this.field_name = field_name;
		this.field_name1 = field_name1;
		nseer_db db = new nseer_db(unit_db_name);
		try
		{
			sql = (new StringBuilder("select * from ")).append(table_name).append(" where ").append(field_name).append("='").append(file_ID).append("'").toString();
			ResultSet rs = db.executeQuery(sql);
			if (rs.next())
				getRateFromID = rs.getDouble(field_name1);
			db.close();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return getRateFromID;
	}
}
